file(GLOB MESHSUBDIV_SOURCE *.cpp *.h)

target_sources(zeno PRIVATE ${MESHSUBDIV_SOURCE})
target_include_directories(zeno PRIVATE .)

find_package(OpenMP REQUIRED)
target_link_libraries(zeno PRIVATE OpenMP::OpenMP_CXX)

set(NO_CLEW ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_CUDA ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_DOC ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_DX ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_EXAMPLES ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_GLEW ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_GLFW ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_GLFW_X11 ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_GLTESTS ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_LIB OFF CACHE BOOL "GUN TMD NO" FORCE)
set(NO_METAL ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_OMP OFF CACHE BOOL "GUN TMD NO" FORCE)
set(NO_OPENCL ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_OPENGL ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_PTEX ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_REGRESSION ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_TBB ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_TESTS ON CACHE BOOL "GUN TMD NO" FORCE)
set(NO_TUTORIALS ON CACHE BOOL "GUN TMD NO" FORCE)

if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/OpenSubdiv/CMakeLists.txt)
    message(FATAL_ERROR "OpenSubdiv submodule not found! Please run: git submodule update --init --recursive")
endif()
add_subdirectory(OpenSubdiv)

if (TARGET osd_dynamic_cpu)
    message(STATUS "Linking with: osd_dynamic_cpu")
    target_link_libraries(zeno PRIVATE osd_dynamic_cpu)
else()
    message(STATUS "Linking with: osd_static_cpu")
    target_link_libraries(zeno PRIVATE osd_static_cpu)
endif()
target_include_directories(zeno PRIVATE OpenSubdiv)
